import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.util.Vector;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class Form1 {

	private JFrame frame;
	private JTable table;
	


	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Form1 window = new Form1();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Form1() {
		initialize();
	}

	

	int cols = 10;
	int rows = 5;



	TableModel createTableModel() {
		TableModel mtm = new TableModel();
		for (int j = 0; j < rows; j++) {
			Vector ro = new Vector();
			for (int i = 0; i < cols; i++) {
				ro.add(RandomString.generateStringAlpha(10));
			}
			mtm.addRowV(ro);
		}
		Vector co = new Vector();
		for (int i = 0; i < cols; i++) {
			co.add(RandomString.generateStringAlpha(5));	
		}
		mtm.setColumnsV(co);
		return mtm;
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JScrollPane scrollPane = new JScrollPane();
		frame.getContentPane().add(scrollPane, BorderLayout.CENTER);

		table = new JTable();
		TableModel tabModel = createTableModel();
		table.setModel(tabModel);
		scrollPane.setViewportView(table);
	}

}
